<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BUILink
 *
 * @author I062261
 */
class BUILink {

    public $linkId;

    public function __construct($linkId = NULL) {
        if ($linkId != NULL)
            $this->linkId = $linkId;
    }

    public function setLinkId($linkId) {
        $this->linkId = $linkId;
    }

    public function setId($linkId) {
        $this->setLinkId($linkId);
    }

    public function getId($data = NULL) {
        return $this->linkId;
    }

    public function addLinkVariable($name, $value) {
        $data = array();
        $data[$name] = $value;
        //yii::app()->session[$this->getId()] = $data;
    }

    public function getLinkVariable($name) {
        if (!empty($_GET) && isset($_GET[$name]))
            return $_GET[$name];
        if (!empty($_POST) && isset($_POST[$name]))
            return $_POST[$name];
        $linkData = Blyn::app()->getUIManager()->getLinkData($this->getId());
        if ($linkData != NULL && is_array($linkData)) {
            if (isset($linkData[$name]))
                return $linkData[$name];
        }
        //$data = yii::app()->session[$this->getId()];
        //if (isset($data[$name]))
            //return $data[$name];
        return NULL;
    }

}

?>
